package org.example.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author liyishan
 * @date 2023/7/18 18:38
 * @apiNote
 */
@RestController
@RequestMapping("testRibbon")
public class TestController {
    @Autowired
    private RestTemplate restTemplate;
    @Value("${service-url.ddd-demo}")
    private String dddServiceUrl;

    @Value("${service-url.zuul-client}")
    private String zuulServiceUrl;

    //依赖 zuul 网关
    @GetMapping("ribbonDemo")
    public String demo1(){
        return restTemplate.getForObject(zuulServiceUrl+"/test/demo",String.class);
    }


    //只依赖 eureka 和  ddd
    @GetMapping("dddDemo")
    public String demo(){
        return restTemplate.getForObject(dddServiceUrl+"/test/demo",String.class);
    }
}
